<script>
	import {
		mapActions,
		mapMutations
	} from 'vuex'
	import config from '@/admin.config.js'
	import {
		version
	} from './package.json'
	import {
		uniAdminCacheKey
	} from './store/constants.js'
	import uploadFileForExtStorage from "@/js_sdk/ext-storage/uploadFileForExtStorage.js"
	export default {
		created() {
			this.clear = undefined
		},
		methods: {
			...mapMutations('app', ['SET_THEME']),
			...mapActions({
				init: 'app/init'
			}),
			clearPlatform() {
				const keysOfPlatform = uni.getStorageInfoSync().keys.filter(key => key.indexOf('platform') > -1)
				keysOfPlatform.length && keysOfPlatform.forEach(key => uni.removeStorageSync(key))
			}
		},
		onPageNotFound(msg) {
			uni.redirectTo({
				url: config.error.url
			})
		},
		onLaunch: function() {
			// #ifdef H5
			console.log(
				`%c uni-admin %c v${version} `,
				'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff',
				'background:#007aff ;padding: 1px; border-radius: 0 3px 3px 0;  color: #fff; font-weight: bold;'
			)
			// #endif
			// #ifdef H5
			// 此处为强制用户必须登录才能访问其他页面，如果需要部分页面不登录也能访问，需要在此过滤这些页面不执行下面的代码或直接注释掉此代码
			// let uni_id_token_expired = uni.getStorageSync("uni_id_token_expired");
			// if (!uni_id_token_expired || uni_id_token_expired < Date.now()) {
			// 	uni.reLaunch({
			// 		url: config.login.url
			// 	})
			// }
			// #endif
			// 线上示例使用
			// console.log('%c uni-app官方团队诚邀优秀前端工程师加盟，一起打造更卓越的uni-app & uniCloud，欢迎投递简历到 hr2013@dcloud.io', 'color: red');
			console.log('App Launch')
			if (this.$uniIdPagesStore.store.hasLogin) {
				this.init()
			}

			// 登录成功回调
			uni.$on('uni-id-pages-login-success', () => {
				this.init()
			})

			// theme
			this.SET_THEME(uni.getStorageSync(uniAdminCacheKey.theme) || 'default')

			// 设置 uniCloud.uploadFile 默认上传的云存储供应商
			uploadFileForExtStorage.init({
				provider: "unicloud", // provider代表默认上传到哪，可选项 "unicloud" 内置存储; "extStorage" 扩展存储;
				domain: "cdn.example.com", //【重要】这里需要改成你开通扩展存储时绑定的自定义域名）
				fileID2fileURL: true, // 将fileID转成fileURL，方便兼容老项目
				// 获取上传参数的函数
				uploadFileOptions: async (event) => {
					// ext-storage-co 是你自己写的云对象，参考代码：https://doc.dcloud.net.cn/uniCloud/ext-storage/dev.html#getuploadfileoptions
					const uniCloudStorageExtCo = uniCloud.importObject("ext-storage-co");
					return await uniCloudStorageExtCo.getUploadFileOptions(event);
				}
			});
		},
		onShow: function() {
			console.log('App Show')
			this.clear = setInterval(() => this.clearPlatform(), 15 * 60 * 1000)
		},
		onHide: function() {
			console.log('App Hide')
			this.clear && clearInterval(this.clear)
		}
	}
</script>

<style lang="scss">
	@import '@/common/uni.css';
	@import '@/common/uni-icons.css';
	@import '@/common/admin-icons.css';
	@import '@/common/theme.scss';

	@font-face {
		font-family: "iconfont";
		/* Project id 4794552 */
		src: url('//at.alicdn.com/t/c/font_4794552_ykavg3oj1.woff2?t=1740974465925') format('woff2'),
			url('//at.alicdn.com/t/c/font_4794552_ykavg3oj1.woff?t=1740974465925') format('woff'),
			url('//at.alicdn.com/t/c/font_4794552_ykavg3oj1.ttf?t=1740974465925') format('truetype');
	}

	.iconfont {
		font-family: "iconfont" !important;
		font-size: 16px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	.ic-hengxian1:before {
		content: "\e604";
	}

	.ic-you:before {
		content: "\e63f";
	}

	.ic-zuo:before {
		content: "\e640";
	}

	.ic-xia:before {
		content: "\e641";
	}

	.ic-shang:before {
		content: "\e643";
	}

	.ic-hengxian:before {
		content: "\e646";
	}

	.ic-dian:before {
		content: "\e607";
	}

	.ic-kefu1:before {
		content: "\e687";
	}

	.ic-dianhua:before {
		content: "\e66e";
	}

	.ic-tupian01-F:before {
		content: "\e63c";
	}

	.ic-h:before {
		content: "\e970";
	}

	.ic-weixiaobiaoqing:before {
		content: "\e642";
	}

	.ic-shanchu2-fang-F:before {
		content: "\e611";
	}

	.ic-baocun-F:before {
		content: "\e616";
	}

	.ic-bofang-fang-F:before {
		content: "\e63d";
	}

	.ic-lianjie-fang-F:before {
		content: "\e63e";
	}

	.ic-qianjin:before {
		content: "\e600";
	}

	.ic-daoru:before {
		content: "\e60e";
	}

	.ic-secaibiaoge:before {
		content: "\e60d";
	}

	.ic-mobanzhongxin-copy:before {
		content: "\ed85";
	}

	.ic-biaotilan:before {
		content: "\e6ad";
	}

	.ic-daima1:before {
		content: "\e68d";
	}

	.ic-shanchu:before {
		content: "\e62d";
	}

	.ic-yinyongfang:before {
		content: "\eb80";
	}

	.ic-jia1:before {
		content: "\e711";
	}

	.ic-zuji:before {
		content: "\e609";
	}

	.ic-gerenxinxi:before {
		content: "\e61d";
	}

	.ic-renzhengyirenzheng:before {
		content: "\e644";
	}

	.ic-guanbituichu:before {
		content: "\e613";
	}

	.ic-a-renzhenggerenrenzheng:before {
		content: "\e71d";
	}

	.ic-share-s:before {
		content: "\e637";
	}

	.ic-share-line:before {
		content: "\e638";
	}

	.ic-sousuo1:before {
		content: "\e61c";
	}

	.ic-gerenxinxibianji:before {
		content: "\e62f";
	}

	.ic-quill-pen-fill:before {
		content: "\e76d";
	}

	.ic-yonghu-:before {
		content: "\e649";
	}

	.ic-nice:before {
		content: "\e639";
	}

	.ic-nice-line:before {
		content: "\e63a";
	}

	.ic-jia:before {
		content: "\e627";
	}

	.ic-talk-line:before {
		content: "\e650";
	}

	.ic-talk-s:before {
		content: "\e651";
	}

	.ic-you:before {
		content: "\e621";
	}

	.ic-fanhui:before {
		content: "\e6a0";
	}

	.ic-shouye:before {
		content: "\e602";
	}

	.ic-fenxiang:before {
		content: "\e603";
	}

	.ic-fenxiang1:before {
		content: "\e691";
	}

	.ic-qunliao:before {
		content: "\e654";
	}

	.ic-a-wenkuwenzhang:before {
		content: "\e6af";
	}

	.ic-baoming:before {
		content: "\e6a2";
	}

	.ic-luxian:before {
		content: "\e601";
	}

	.ic-shijianxuanzeqi:before {
		content: "\e750";
	}

	.ic-weizhi:before {
		content: "\e670";
	}

	.ic-qingchu:before {
		content: "\e608";
	}

	.ic-sousuo:before {
		content: "\e6ac";
	}

	.ic-guanbi:before {
		content: "\e7e8";
	}

	view,
	swiper-item,
	scroll-view,
	text,
	input,
	button,
	cover-image,
	cover-view,
	image,
	form,
	label,
	progress,
	switch,
	textarea,
	rich-text,
	audio,
	video {
		box-sizing: border-box;
	}


	button::after {
		border: none;
	}


	.w-100 {
		width: 100%;
	}

	.w-90 {
		width: 90%;
	}

	.w-85 {
		width: 85%;
	}

	.w-80 {
		width: 80%;
	}

	.w-70 {
		width: 70%;
	}

	.w-60 {
		width: 60%;
	}

	.w-50 {
		width: 50%;
	}

	.w-48 {
		width: 48%;
	}

	.w-46 {
		width: 46%;
	}

	.w-25 {
		width: 25%;
	}

	.w-10 {
		width: 10%;
	}

	.min-h-100 {
		min-height: 100vh;
	}

	.h-310 {
		height: 310rpx;
	}

	.h-100-vh {
		height: 100vh;
	}

	.h-70-vh {
		height: 70vh;
	}

	.h-60-vh {
		height: 60vh;
	}


	.h-100 {
		height: 100%;
	}


	.h-100-r {
		height: 100rpx;
	}

	.h-90 {
		height: 90rpx;
	}

	.lh-100 {
		line-height: 100rpx;
	}

	.lh-90 {
		line-height: 90rpx;
	}

	.lh-70 {
		line-height: 70rpx;
	}

	.lh-50 {
		line-height: 50rpx;
	}

	.lh-40 {
		line-height: 40rpx;
	}

	.lh-30 {
		line-height: 30rpx;
	}

	.lh-20 {
		line-height: 20rpx;
	}

	.text-ali-c {
		text-align: center;
	}

	.text-ali-r {
		text-align: right;
	}

	/* 阴影 */
	.box-s-888 {
		box-shadow: 0rpx 8rpx 20rpx #b5b5b5;
	}

	/* 文字超过4行 */
	.text-element-4 {
		display: -webkit-box !important;
		-webkit-box-orient: vertical;
		overflow: hidden;
		-webkit-line-clamp: 4;
		/* 控制显示的行数 */
	}

	/* 文字超过2行 */
	.text-element-2 {
		display: -webkit-box !important;
		-webkit-box-orient: vertical;
		overflow: hidden;
		-webkit-line-clamp: 2;
		/* 控制显示的行数 */
	}

	/* 文字超过1行 */
	.text-element-1 {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		overflow: hidden;
		-webkit-line-clamp: 1;
		/* 控制显示的行数 */
	}

	.flex-1 {
		display: flex;
		flex: 1;
	}

	/* 垂直排列 */
	.flex-dir-col {
		display: flex;
		flex-direction: column;
	}

	/* 居中 */
	.ali-item-cen {
		display: flex;
		align-items: center;
	}


	.ali-item-sta {
		display: flex;
		align-items: flex-start;
	}

	.ali-item-bas {
		display: flex;
		align-items: baseline;
	}

	/* 水平排列，不换行 */
	.flex-dir-row {
		display: flex;
		flex-direction: row;
	}

	.pos-rela {
		position: relative;
	}

	.pos-fixed {
		position: fixed;
	}

	.pos-abso {
		position: absolute;
	}

	/* 强制换行 */
	.flex-w-wrap {
		flex-wrap: wrap;
	}

	/* 右侧对齐 */
	.flex-r-end {
		display: flex;
		justify-content: flex-end;
	}

	/* 平均分布 */
	.flex-x-bet {
		display: flex;
		justify-content: space-between;
	}

	/* 平均分布2 */
	.flex-x-spa {
		display: flex;
		justify-content: space-around;
	}

	.flex-center {
		display: flex;
		justify-content: center;
	}

	.f-wrap {
		flex-wrap: wrap;
	}


	.ml-50 {
		margin-left: 50rpx;
	}

	.ml-30 {
		margin-left: 30rpx;
	}

	.ml-20 {
		margin-left: 20rpx;
	}

	.ml-15 {
		margin-left: 15rpx;
	}

	.ml-10 {
		margin-left: 10rpx;
	}

	.ml-5 {
		margin-left: 5rpx;
	}

	.mb-50 {
		margin-bottom: 50rpx;
	}

	.mb-40 {
		margin-bottom: 40rpx;
	}

	.mb-30 {
		margin-bottom: 30rpx;
	}

	.mb-20 {
		margin-bottom: 20rpx;
	}

	.mb-10 {
		margin-bottom: 10rpx;
	}

	.mb-5 {
		margin-bottom: 5rpx;
	}

	.mt-106 {
		margin-top: 106rpx;
	}

	.mt-80 {
		margin-top: 80rpx;
	}

	.mt-70 {
		margin-top: 70rpx;
	}

	.mt-60 {
		margin-top: 60rpx;
	}

	.mt-50 {
		margin-top: 50rpx;
	}

	.mt-40 {
		margin-top: 40rpx;
	}

	.mt-30 {
		margin-top: 30rpx !important;
	}

	.mt-20 {
		margin-top: 20rpx;
	}

	.mt-10 {
		margin-top: 10rpx;
	}

	.mt-5 {
		margin-top: 5rpx;
	}

	.mr-50 {
		margin-right: 50rpx;
	}

	.mr-40 {
		margin-right: 40rpx;
	}

	.mr-30 {
		margin-right: 30rpx;
	}

	.mr-20 {
		margin-right: 20rpx;
	}

	.mr-10 {
		margin-right: 10rpx;
	}

	.mr-5 {
		margin-right: 5rpx;
	}

	.ma {
		margin: auto;
	}

	.pr-10 {
		padding-right: 10rpx;
	}

	.pr-20 {
		padding-right: 20rpx;
	}

	.pt-60 {
		padding-top: 60rpx !important;
	}

	.pt-50 {
		padding-top: 50rpx !important;
	}

	.pt-40 {
		padding-top: 40rpx !important;
	}

	.pb-100 {
		padding-bottom: 100rpx !important;
	}

	.pb-40 {
		padding-bottom: 40rpx !important;
	}

	.pb-30 {
		padding-bottom: 30rpx !important;
	}

	.pb-20 {
		padding-bottom: 20rpx !important;
	}

	.pb-10 {
		padding-bottom: 10rpx;
	}

	.pb-0 {
		padding-bottom: 0rpx !important;
	}

	.pt-30 {
		padding-top: 30rpx !important;
	}

	.pt-20 {
		padding-top: 20rpx !important;
	}

	.pt-10 {
		padding-top: 10rpx !important;
	}

	.pt-0 {
		padding-top: 0rpx !important;
	}

	.ping-40 {
		padding: 40rpx;
	}

	.ping-30 {
		padding: 30rpx;
	}

	.ping-10-20 {
		padding: 10rpx 20rpx;
	}

	.ping-13-25 {
		padding: 13rpx 25rpx;
	}

	.ping-20 {
		padding: 20rpx;
	}

	.ping-15 {
		padding: 15rpx;
	}

	.ping-10 {
		padding: 10rpx;
	}

	.ping-15-80 {
		padding: 15rpx 80rpx;
	}

	.ping-30-0 {
		padding: 30rpx 0rpx;
	}

	.ping-20-0 {
		padding: 20rpx 0rpx;
	}

	.ping-0-35 {
		padding: 0rpx 35rpx;
	}

	.ping-0-30 {
		padding: 0rpx 30rpx;
	}


	.ping-0-20 {
		padding: 0rpx 20rpx;
	}

	.ping-0-10 {
		padding: 0rpx 10rpx;
	}

	.ping-6-10 {
		padding: 4rpx 10rpx;
	}

	.ping-5-15 {
		padding: 5rpx 15rpx;
	}

	.brtl-20 {
		border-top-left-radius: 20rpx;
	}

	.brbl-20 {
		border-bottom-left-radius: 20rpx;
	}

	.brtr-20 {
		border-top-right-radius: 20rpx;
	}

	.brbr-20 {
		border-bottom-right-radius: 20rpx;
	}

	.br-200 {
		border-radius: 200rpx;
	}

	.br-40 {
		border-radius: 40rpx;
	}

	.br-30 {
		border-radius: 30rpx;
	}

	.br-20 {
		border-radius: 20rpx;
	}

	.br-10 {
		border-radius: 10rpx;
	}

	.col-f {
		color: #fff !important;
	}

	.col-0 {
		color: #000;
	}

	.col-54 {
		color: #303030;
	}

	.col-87 {
		color: #878787;
	}

	.col-b1 {
		color: #b1bbb1;
	}

	.col-00ba31 {
		color: #14cc60;
	}

	.col-0a2e36 {
		color: #0a2e36;
	}

	.col-0a2e365e {
		color: #0a2e365e;
	}

	.col-0a2e360a {
		color: #0a2e360a;
	}

	.col-27fb6b {
		color: #27fb6b;
	}

	.col-4e {
		color: #409cff;
	}

	.col-ff4 {
		color: #ff4c4c;
	}

	.bac-col-00b {
		background: #14cc60 !important;
	}

	.bac-col-0a20a {
		background: #0a2e360a !important;
	}

	.bac-col-ffd {
		background: #efd941 !important;
	}

	.bac-col-68 {
		background: #14cc6026;
	}

	.bac-col-4e {
		background: #409cff;
	}

	.bac-col-f {
		background: #fff !important;
	}

	.bac-col-fa {
		background: #f7f7f7;
	}

	.bac-col-05 {
		background: #00000005;
	}

	/* 竖线 */
	.shu {
		width: 10rpx;
		border-radius: 200rpx;
		background: #676768;
	}

	/* 横线 */
	.heng {
		width: 100%;
		height: 20rpx;
		background: #f7f8fa;
	}

	.fs-56 {
		font-size: 56rpx;
	}

	.fs-50 {
		font-size: 50rpx;
	}

	.fs-48 {
		font-size: 48rpx;
	}

	.fs-46 {
		font-size: 46rpx;
	}

	.fs-44 {
		font-size: 44rpx;
	}

	.fs-42 {
		font-size: 42rpx;
	}

	.fs-40 {
		font-size: 40rpx;
	}

	.fs-38 {
		font-size: 38rpx;
	}

	.fs-36 {
		font-size: 36rpx;
	}

	.fs-34 {
		font-size: 34rpx;
	}

	.fs-32 {
		font-size: 32rpx;
	}

	.fs-15x {
		font-size: 15px;
	}

	.fs-31 {
		font-size: 31rpx;
	}

	.fs-30 {
		font-size: 30rpx;
	}

	.fs-28 {
		font-size: 28rpx;
	}

	.fs-26 {
		font-size: 26rpx
	}

	.fs-24 {
		font-size: 24rpx
	}

	.fs-22 {
		font-size: 22rpx
	}

	.fs-20 {
		font-size: 20rpx
	}

	.fw-900 {
		font-weight: 900;
	}

	.fw-600 {
		font-weight: 600;
	}

	/* 强制文字不换行 */
	.whi-sp {
		white-space: nowrap;
	}

	/* 强制换行 */
	.fwrap-wr {
		flex-wrap: wrap;
	}

	// 防挤压
	.flex-shrink-0 {
		flex-shrink: 0;
	}

	::-webkit-scrollbar {
		display: none;
	}

	.dh-0-4s {
		-webkit-animation-duration: 0.4s;
		animation-duration: 0.4s;
	}

	.dh-0-6s {
		-webkit-animation-duration: 0.6s;
		animation-duration: 0.6s;
	}

	.dh-1s {
		-webkit-animation-duration: 1s;
		animation-duration: 1s;
	}

	//按钮背景
	.btn-bg {
		background: #0a2e36;
		width: 150rpx;
		height: 60rpx;
		line-height: 60rpx;
		transition: transform 0.2s ease, box-shadow 0.2s ease;
	}

	.btn-bg:active {
		transform: scale(0.9);
		/* 点击时按钮缩小 */
		box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
		/* 点击时添加阴影 */
	}


	//按钮文字样式
	.gradient-text {
		background-image: linear-gradient(to right, #27fb6b, #27fb6b);
		font-weight: bold;
		/* 让背景应用到文字 */
		-webkit-background-clip: text;
		color: transparent;
		/* 让文字本身透明，这样才显示渐变 */
	}

	// 上边框
	.bor-top-f3 {
		border-top: 1rpx solid #f3f3f3;
	}

	// 下边框
	.bor-bottom-f3 {
		border-bottom: 1rpx solid #f3f3f3;
	}

	// 适配底部横条
	.bottom-h {
		padding-bottom: 30rpx !important;
		padding-bottom: calc(20rpx + constant(safe-area-inset-bottom)) !important;
		padding-bottom: calc(20rpx + env(safe-area-inset-bottom)) !important;
	}

	.bottom-index {
		padding-bottom: 30rpx !important;
		padding-bottom: calc(109rpx + constant(safe-area-inset-bottom)) !important;
		padding-bottom: calc(109rpx + env(safe-area-inset-bottom)) !important;
	}

	//模糊背景
	.vague-bg-9 {
		background: rgba(255, 255, 255, 0.9);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	.vague-bg-8 {
		background: rgba(255, 255, 255, 0.8);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	.vague-bgfa-8 {
		background: rgba(250, 250, 250, 0.8);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
	}

	.vague-bg-5 {
		background: rgba(255, 255, 255, 0.5);
		backdrop-filter: blur(10px);
		-webkit-backdrop-filter: blur(10px);
		/* 背景模糊效果 */
	}

	.vague-bg-0 {
		background: rgba(255, 255, 255, 0);
	}

	.border-f0 {
		border: 1rpx solid #f0f0f0;
	}

	.border-bf {
		border: 1rpx solid #bfbfbf;
	}

	//拟物
	.box-nw {
		box-shadow: 8rpx 8rpx 16rpx rgba(0, 0, 0, 0.15), -8rpx -8rpx 16rpx rgba(255, 255, 255, 0.7);
	}

	.overflow-h {
		overflow: hidden;
	}

	// 加载中蒙版
	.mask-load {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		z-index: 9999;
		background: #ffffff73;
	}

	// 文字边框
	.text-border {
		text-shadow:
			-2px -2px 2px white,
			2px -2px 2px white,
			-2px 2px 2px white,
			2px 2px 2px white;
	}
</style>